﻿@using Kairos.Controllers
@using Kairos.Views

@model Kairos.Models.Vtom

@{
    ViewBag.Title = "Job Vtom";
}

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Vtom</legend>

        @Html.HiddenFor(model => model.ID)

        @Html.HiddenFor(model => model.Titre)

        @if (ViewBag.Reason == Reason.Force)
        {
            <hgroup class="title">
                <h1 class="error">Erreur.</h1>
                <h2 class="error">Aucune consigne affectée.</h2>
            </hgroup>
            <br />
        }

        <div class="display-field">
            <h2 style="font-weight:normal;">
                <mark class="ui-corner-all">
                    @Html.DisplayFor(model => model.Titre)
                </mark>
            </h2>
        </div>
        <br />

        @if (ViewBag.ShouldDisplayUI(Kairos.Roles.Administrator | Kairos.Roles.Worker))
        {
            <div class="editor-label">
                @Html.LabelFor(model => model.DocID)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.DocID)
                @Html.ValidationMessageFor(model => model.DocID)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.Variables)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Variables)
                @Html.ValidationMessageFor(model => model.Variables)
            </div>
        }
    </fieldset>

    if (ViewBag.ShouldDisplayUI(Kairos.Roles.Administrator | Kairos.Roles.Worker))
    {
        <hr />

        <table class="props">
            <tr>
                <td>
                    <div>
                        if (ViewBag.Reason == Reason.Affect)
                        {
                            @Html.ButtonLink("Annuler", "Alarme", null, new { @class = "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" })
                        }

                        if (ViewBag.Reason == Reason.Standard)
                        {
                            @Html.ButtonLink("Annuler", "Index", null, new { @class = "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" })
                        }
                    </div>
                </td>
                <td align="right">
                    <div>
                        <input type="submit" value="Sauvegarder" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" />
                    </div>
                </td>
            </tr>
        </table>
    }
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
